<?php 
//$vMAPAS_DISPONIBLES_CONFIG = explode(",",MAPAS_DISPONIBLES);
$vMAPAS_DISPONIBLES = mapasDisponibles(MAPAS_DISPONIBLES, $LOGIN->MAPAS_DISPONIBLES);
$bTieneMapas = (count($vMAPAS_DISPONIBLES)>0)? true:false;
if($LOGIN->GEOCODING=="" || $LOGIN->GEOCODING==null){
	$GEOCODING	= 0;
}else{
	$GEOCODING	= $LOGIN->GEOCODING;
}
if($LOGIN->REVERSE_GEOCODING=="" || $LOGIN->REVERSE_GEOCODING==null){
	$REVERSE_GEOCODING	= 0;
}else{
	$REVERSE_GEOCODING	= $LOGIN->REVERSE_GEOCODING;
}
if($LOGIN->ROUTING=="" || $LOGIN->ROUTING==null){
	$ROUTING	= 0;
}else{
	$ROUTING	= $LOGIN->ROUTING;
}
$scriptGoogle 		= false;
$scriptCloudMade 	= false;
$scriptBykom		= false;
switch((int)$ROUTING){
	case 1: $scriptGoogle 	= true;				
			break;
	case 2: $scriptBykom	= true;
			break;
	case 3: $scriptCloudMade= true;
			break;
}
switch((int)$REVERSE_GEOCODING){
	case 1: $scriptGoogle 	= true;				
			break;
	case 2: $scriptBykom	= true;
			break;
	case 3: $scriptCloudMade= true;
			break;
}
switch((int)$GEOCODING){
	case 1: $scriptGoogle 	= true;				
			break;
	case 2: $scriptBykom	= true;
			break;
	case 3: $scriptCloudMade= true;
			break;
}
?>
<script type="text/javascript">
	vMAPAS_DISPONIBLES 	= '<?=implode(",",$vMAPAS_DISPONIBLES);?>';
	AVL_BOUNDS			= '<?=AVL_BOUNDS?>';
	AVL_SCALES_LIST		= '<?=AVL_SCALES_LIST?>';
	AVL_MAP_SERVER_IP	= '<?=$AVL_MAP_SERVER_IP?>';	
	AVL_MAP_SERVER_PORT	= '<?=$AVL_MAP_SERVER_PORT?>';	
	AVL_MAP_SERVER_ADMIN= '<?=AVL_MAP_SERVER_ADMIN?>';	
	AVL_MAP_SERVER_PASSW= '<?=AVL_MAP_SERVER_PASSW?>';	
	AVL_MAP_DEFINITION	= '<?=AVL_MAP_DEFINITION?>';	
	AVL_MAP_BASE_LAYER_GROUP	= '<?=AVL_MAP_BASE_LAYER_GROUP?>';	
	YAHOOMAP_KEY		= '<?=YAHOOMAP_KEY?>';	
	MSMAP_KEY			= '<?=MSMAP_KEY?>';	
</script>
<?php 
$mapType = strtolower($_GET['mapType']);
if(!in_array($mapType,$vMAPAS_DISPONIBLES)){
	$mapType = $vMAPAS_DISPONIBLES[0];
	?>
	<script type="text/javascript">
		toMapType = '<?=$vMAPAS_DISPONIBLES[0]?>';
	</script>
	<?php 
}
if(CAMBIO_DE_MAPA==1){
	if(in_array($mapType, $vMAPAS_DISPONIBLES)){
		switch($mapType){
			case "google": ?>
				<script type="text/javascript" src="http://maps.google.com/maps?file=api&amp;v=2.x&amp;key=<?=GMAP_KEY?>" type="text/javascript"></script>
			<?php 
				break;
			case "virtualearth": ?>
				<script type="text/javascript" src="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.3"></script>
			<?php
				break; 
			case "yahoo": ?>
				<script type="text/javascript" src="http://api.maps.yahoo.com/ajaxymap?v=3.0&appid=euzuro-openlayers"></script>
			<?php 
				break;
		}
	}
}else{
	if(in_array('bykom', $vMAPAS_DISPONIBLES)){?>
<?php }
	if(in_array('google', $vMAPAS_DISPONIBLES)){?>
	  <script type="text/javascript" src="http://maps.google.com/maps?file=api&amp;v=2.x&amp;key=<?=GMAP_KEY?>" type="text/javascript"></script>
<?php } 
	if(in_array('openstreet', $vMAPAS_DISPONIBLES)){?>
<?php }	 
	if(in_array('virtualearth', $vMAPAS_DISPONIBLES)){?>
	<script type="text/javascript" src="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.3"></script>
<?php } 
	if(in_array('yahoo', $vMAPAS_DISPONIBLES)){?>
	<script type="text/javascript" src="http://api.maps.yahoo.com/ajaxymap?v=3.0&appid=euzuro-openlayers"></script>
<?php }	
}

if($scriptGoogle){ ?>
	<script type = "text/javascript" src = "http://maps.google.com/maps/api/js?sensor=false"></script>
<?php 
}
if($scriptCloudMade){ ?>
	<script type = "text/javascript" src = "http://tile.cloudmade.com/wml/latest/web-maps-lite.js"></script>
	<script type="text/javascript">
		CLOUDMADE_KEY = '<?=CLOUDMADE_KEY?>';
	</script>
<?php 	
}
?>